#include"processbar.h"
#include<time.h>
#include<stdlib.h>
#include<unistd.h>

#define FILESIZE 1024*1024*1024 //~1G

void download()
{
    srand(time(NULL)^1023);
    int total = FILESIZE;
    while(total)
    {
        usleep(10000); 
        int one = rand()%(1024*1024*5);   //下载速度->10M
        total -= one;
        if(total < 0) total = 0;
        //当前进度
        int download = (FILESIZE) - total;
        double rate =(download*1.0 / (FILESIZE))*100;   //显示整数
        process2(rate);
    }
}




int main()
{
    //vision 1
    //process1();
    download();

    return 0;
}
